﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSem3
{
    public partial class WebForm4 : System.Web.UI.Page
    {
        private DataClassesHeaxlthDataContext dc = new DataClassesHeaxlthDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                EmpRegister Semp = (EmpRegister)Session["member"];
                if (Semp == null)
                {
                    Response.Redirect("member.aspx");
                }
                else
                {
                    this.LabelUsername.Text = Semp.username;
                    this.Baokq.Visible = false;
                    this.ultext.Visible = true;
                }
            }
        }

        protected void ButtonSend_Click(object sender, EventArgs e)
        {
            EmpRegister Semp = (EmpRegister)Session["member"];
            int empno = Semp.empno;
            string email = this.TextBoxEmail.Text;
            string feedback = this.TextBoxFeedback.Text;
            sendfeedback(empno, email, feedback);
            this.Baokq.Visible = true;
            this.ultext.Visible = false;
        }
        public void sendfeedback(int empno, string email, string feedback)
        {
            Feedback fb = new Feedback();
            fb.email = email;
            fb.feedback1 = feedback;
            fb.empno = empno;
            this.dc.Feedbacks.InsertOnSubmit(fb);
            this.dc.SubmitChanges();
        }
    }
}